/*
 * test.c
 *
 * Created: 17/05/2012 12:44:09
 *  Author: Dani
 */ 


#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd162.h"
#include "switch.h"
#include "uart.h"
#include "eeprom.h"

#define ADDRESS_q 1
#define ADDRESS_a 5
#define ADDRESS_e 7

int main(void)
{
	uint16_t temp;
	
	LCDInit();
	UARTInit(9600,8);
	SwitchInit();
	
	// q
	EEPROMWrite((uint16_t)ADDRESS_q, 11);
	temp = EEPROMRead((uint16_t)ADDRESS_q);
	UARTSendInteger(temp);
	
	UARTSendString("-- e -------");
	
	// e
	EEPROMWrite((uint16_t)ADDRESS_e, 33);
	temp = EEPROMRead((uint16_t)ADDRESS_e);
	UARTSendInteger(temp);
	
	temp = EEPROMRead((uint16_t)ADDRESS_q);
	UARTSendInteger(temp);
	
	temp = EEPROMRead((uint16_t)ADDRESS_e);
	UARTSendInteger(temp);
	
	temp = EEPROMRead((uint16_t)ADDRESS_q);
	UARTSendInteger(temp);
	
	temp = EEPROMRead((uint16_t)ADDRESS_a);
	UARTSendInteger(temp);
	
	UARTSendString("-- w -------");
	
	// w
	EEPROMWrite((uint16_t)ADDRESS_a,66);
	temp = EEPROMRead((uint16_t)ADDRESS_q);
	UARTSendInteger(temp);
	temp = EEPROMRead((uint16_t)ADDRESS_e);
	UARTSendInteger(temp);
	temp = EEPROMRead((uint16_t)ADDRESS_a);
	UARTSendInteger(temp);
 
	while(1)
    {
    }
}